package com.cn.dao;

import com.cn.entity.CostCase;
import com.cn.util.DBUtil;

import java.sql.ResultSet;
import java.sql.SQLException;

public class QueryCostCase {
    static ResultSet rs=null;
    static CostCase costCase=null;
    public static CostCase getQueryCase(int taocanid){
        String sql="select * from costcase where id=?";
        Object[] obj={taocanid};
        rs=DBUtil.query(sql,obj);
        if(rs!=null){
            try {
                if(rs.next()){
                    int id1 = rs.getInt("id");
                    String type1 = rs.getString("type");
                    String  desc1 = rs.getString("desc");
                    int cost1 = rs.getInt("cost");
                    costCase=new CostCase(id1,type1,desc1,cost1);
                }
            } catch (SQLException e) {
                e.printStackTrace();
                return null;
            }catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }
        return costCase;
    }
}
